package 面向对象.battleGame;

public class GameTest1 {
    public static void main(String[] args) {

        Role r1 = new Role("莱伊", 2133);
        Role r2 = new Role("提丰", 1912);

        int i = 1;

        while (true) {

            //记录回合数
            System.out.println("第" + i + "回合");

            //r1攻击r2
            r1.attack(r2);

            //判断r2生命值是否为0
            if ( r2.getHp() == 0 ) {
                System.out.println();
                System.out.println(r1.getName() + "击败了" + r2.getName());
                break;
            }

            //r2攻击r1
            r2.attack(r1);

            //判断r1生命值是否为0
            if ( r1.getHp() == 0 ) {
                System.out.println();
                System.out.println(r2.getName() + "击败了" + r1.getName());
                break;
            }

            //回合数加1
            i++;
        }
    }
}
